<?php

namespace app\controllers;

use Yii;
use yii\web\Controller;
use yii\web\Response;

use app\services\PackageSyncService;

class PackageSyncController extends AuthController
{
    public $currentHeader = 'header-sync';
    public $currentNav = 'launch-rule-sync-nav';
    public $pageTitle = '';

    public function init() {
        parent::init();
        $this->service = new PackageSyncService();
    }

    public function actionSyncList() {
        $this->pageTitle = $this->t('package', 'Package Syncronization');
        return $this->show();
    }

    public function actionSyncHandle () {
        $this->service->update();
    }

    public function actionGetPackageScheduleList() {
        $data = $this->service->getPackageScheduleList();
        $this->jsonReturn(['data' => $data]);
    }
}// end
